package com.administrator.shiniang;

import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.ActionBarActivity;
import android.support.v7.widget.Toolbar;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.ListView;

import java.util.ArrayList;
import java.util.List;

import butterknife.ButterKnife;
import butterknife.InjectView;


public class MainActivity extends ActionBarActivity {

    @InjectView(R.id.lv)
    ListView mListItem;
    @InjectView(R.id.toolbar)
    Toolbar mToolbar;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        ButterKnife.inject(this);
        setSupportActionBar(mToolbar);
        // Inflate a menu to be displayed in the toolbar
        mListItem.setAdapter(new ArrayAdapter<String>(this, android.R.layout.simple_expandable_list_item_1, getItem()));
        mListItem.setOnItemClickListener(new AdapterView.OnItemClickListener() {
            @Override
            public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
                if(getItem().get(position).equals("Toolbar")) {
                   jump(ToolbarActivity.class);
                }else if (getItem().get(position).equals("Emoji")){
                    jump(EmojiActivity.class);
                }else if (getItem().get(position).equals("Test")){
                    jump(TranslationAnimationActivity.class);
                }

            }
        });
    }

    private List<String> getItem() {

        List<String> data = new ArrayList<String>();
        data.add("Toolbar");
        data.add("Emoji");
        data.add("Test");
        data.add("测试数据4");

        return data;
    }
    private void jump(Class OtherActivity){
        Intent intent = new Intent(MainActivity.this,OtherActivity);
        startActivity(intent);
    }

}
